<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>元素居中</title>
  <style>
    *.clear{
      clear: both;
    }
    #nav li {
      list-style: none;
    }
    li.nav_li {
      height:50px;
      width:130px;
      border:1px solid #aaa;
      float:left;
    }
    li.nav_li span {
      position: relative;
      left:20px;
      top:13px;
    }
    #nav2 li {
      list-style: none;
    }
    li.nav2_li {
      float:left;
      border:1px solid red;
      padding:15px;
    }
  </style>
</head>
<body>
  <ul id="nav">
    <!--li[class='nav_li']*10>span{导航链接$$}-->
    <li class="nav_li"><span>导航链接01</span></li>
    <li class="nav_li"><span>导航链接02</span></li>
    <li class="nav_li"><span>导航链接03</span></li>
    <li class="nav_li"><span>导航链接04</span></li>
    <li class="nav_li"><span>导航链接05</span></li>
    <li class="nav_li"><span>导航链接06</span></li>
    <li class="nav_li"><span>导航链接07</span></li>
    <li class="nav_li"><span>导航链接08</span></li>
    <li class="nav_li"><span>导航链接09</span></li>
    <li class="nav_li"><span>导航链接10</span></li>
    <li class="clear"></li>
  </ul>
  <ul id="nav2">
    <li class="nav2_li">再次测试01</li>
    <li class="nav2_li">再次测试02</li>
    <li class="nav2_li">再次测试03</li>
    <li class="nav2_li">再次测试04</li>
    <li class="nav2_li">再次测试05</li>
    <li class="nav2_li">再次测试06</li>
    <li class="nav2_li">再次测试07</li>
    <li class="nav2_li">再次测试08</li>
    <li class="nav2_li">再次测试09</li>
    <li class="nav2_li">再次测试10</li>
    <li class="clear"></li>
  </ul>
</body>
</html>